package org.jeecg.modules.health_records.health_basepro.service.impl;

import org.jeecg.modules.health_records.health_basepro.entity.HealthBaseProjectInfo;
import org.jeecg.modules.health_records.health_basepro.mapper.HealthBaseProjectInfoMapper;
import org.jeecg.modules.health_records.health_basepro.service.IHealthBaseProjectInfoService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import org.springframework.transaction.annotation.Transactional;

import java.util.List;

/**
 * @Description: 现病史基础指标信息表
 * @Author: jeecg-boot
 * @Date:   2025-06-27
 * @Version: V1.0
 */
@Service
public class HealthBaseProjectInfoServiceImpl extends ServiceImpl<HealthBaseProjectInfoMapper, HealthBaseProjectInfo> implements IHealthBaseProjectInfoService {

    @Autowired
    private HealthBaseProjectInfoMapper healthBaseProjectInfoMapper;
    /**按recordid查询**/
    @Override
    @Transactional(rollbackFor = Exception.class)
    public List<HealthBaseProjectInfo> queryByRecordId(HealthBaseProjectInfo healthBaseProjectInfo){

        return healthBaseProjectInfoMapper.queryByRecordId(Long.valueOf(healthBaseProjectInfo.getRecordid()),healthBaseProjectInfo.getIdNumber());

    }
    //新规则查询当下时间往前12个月的就诊数据作为电子病历数据
    @Override
    @Transactional(rollbackFor = Exception.class)
    public List<HealthBaseProjectInfo> newQueryElecRecord(HealthBaseProjectInfo healthNeurIndexInf) {
        return healthBaseProjectInfoMapper.newQueryElecRecord(Long.valueOf(healthNeurIndexInf.getRecordid()),healthNeurIndexInf.getSeeId(),healthNeurIndexInf.getIdNumber());

    }

    //新规则：除去当下时间往前12个月的就诊数据，剩下的数据为既往病历数据
    @Override
    @Transactional(rollbackFor = Exception.class)
    public List<HealthBaseProjectInfo> newQueryPastRecord(HealthBaseProjectInfo healthNeurIndexInf) {
        return healthBaseProjectInfoMapper.newQueryPastRecord(Long.valueOf(healthNeurIndexInf.getRecordid()),healthNeurIndexInf.getSeeId(),healthNeurIndexInf.getIdNumber());

    }
}
